package com.big_data.main.mapper;

import com.big_data.main.model.dao.OriginalCovid19MapWangyi;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
* @author z2l2y
* @description 针对表【original_covid19_map_wangyi】的数据库操作Mapper
* @createDate 2022-05-16 22:24:36
* @Entity generator.domain.OriginalCovid19MapWangyi
*/
public interface OriginalCovid19MapWangyiMapper extends BaseMapper<OriginalCovid19MapWangyi> {

    @Select("select sum(total_confirm) as total_confirm,\n" +
            "sum(total_dead) as total_dead, sum(total_heal) as total_heal,\n" +
            "SUM(today_confirm) as today_confirm, SUM(today_dead) as today_dead,\n" +
            "SUM(today_heal) as today_heal FROM original_covid19_map_wangyi\n" +
            "WHERE parent_address_id is null")
    OriginalCovid19MapWangyi getInfoForWord();

    @Select("select * from original_covid19_map_wangyi where parent_address_id is null order by (total_confirm - total_dead - total_heal) desc")
    List<OriginalCovid19MapWangyi> getMapTopForWord();

    @Select("select * from original_covid19_map_wangyi where parent_address_id = #{id} order by (total_confirm - total_dead - total_heal) desc")
    List<OriginalCovid19MapWangyi> getMapTopForAreaId(Integer id);
}




